<!DOCTYPE html>
<html>
<head>
	<title>krpano</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, viewport-fit=cover" />
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta name="apple-mobile-web-app-status-bar-style" content="black" />
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<meta http-equiv="x-ua-compatible" content="IE=edge" />
	<style>
		@-ms-viewport { width:device-width; }
		@media only screen and (min-device-width:800px) { html { overflow:hidden; } }
		html { height:100%; }
		body { height:100%; overflow:hidden; margin:0; padding:0; font-family:Arial, Helvetica, sans-serif; font-size:16px; color:#FFFFFF; background-color:#000000; }
	</style>
</head>
<body>

<script src="../krpano.js"></script>
	<li id="auto" onclick="setAuto();" style="position:fixed; z-index:666666; top:20px;">开启自动旋转</li>
	<div id="pano" style="width:100%;height:100%;">
	<noscript><table style="width:100%;height:100%;"><tr style="vertical-align:middle;text-align:center;"><td>ERROR:<br><br>Javascript not activated<br><br></td></tr></table></noscript>
	<script>
			//初始化
			var krpano = null;
			embedpano({swf:"../krpano.swf", xml:"gyro.xml", target:"pano", html5:"auto", mobilescale:1.0, passQueryParameters:true,
				onready:krpano_onready_callback,
				onerror:krpano_onerror_callback});
					//准备完成回调，获取krpano接口实例
			function krpano_onready_callback(krpano_interface){
				console.log(krpano_interface);
				krpano = krpano_interface;
			};
			//实例化失败
			function krpano_onerror_callback(err){
				alert(err);
			};
			//设置自动旋转
			function setAuto(){
				if (krpano){
					//自动旋转当前状态
					var autorotate = Number(krpano.get("autorotate.enabled"));
					console.log(autorotate)
					//重力感性和螺旋仪效果当前状态
					console.log(Number(krpano.get("plugin[gyro].enabled")))
					if(autorotate==1){//自动旋转
						this.innerHTML="开启自动旋转";
						/*停止旋转*/	
						krpano.set("autorotate.enabled", false);  
						//开启重力感性和螺旋仪效果
						krpano.set("plugin[gyro].enabled", true);  
					}else{
						this.innerHTML="关闭自动旋转";
						/*自动旋转*/
						krpano.set("autorotate.enabled", true);  
						//关闭重力感性和螺旋仪效果
						krpano.set("plugin[gyro].enabled", false);  
					};
				};
			};			
	</script>
    <script>
	/*
		360度全景插件
		地址：https://krpano.com/
		中文教程：http://www.krpano360.com/
		方法接口归档：http://blog.csdn.net/u012054869/article/details/78394781
	*/
    </script>
</div>

</body>
</html>
